<!DOCTYPE html>
<html>
	<head>
		<meta charset="utf-8">
		<title></title>
	</head>
	<body>
		<script>
			//创建字符串
			var str1=new String("abc123");
			var str2="abc";
			
			console.log(str1.length);
			
			String.prototype.getLength=function(){
				return this.length;
			}
			var str3=new String("abcdef");
			console.log(str3.getLength());
			
			//操作方法
			var str4="abcdefg";
			console.log(str4.charAt(3));
			for(var i=0;i<str4.length;i++){
				console.log(str4.charAt(i));
			}
			var str5="Hello world,Good Bye world!";
			console.log(str5.indexOf("world"));
			console.log(str5.indexOf("world"));
			console.log(str5.indexOf("world",11));
			console.log(str5.indexOf("world"));
			
			//截取
			var str6="abcdefghijklmn";
			console.log(str6.slice(3,8));
			console.log(str6.substr(3,5));
			console.log(str6.substring(3,8));
			
			function foo1(path){
				var path="d:/abc/aaa/";
				var pos=path.lastIndexOf("/");
				var tempPath=path.substr(0,pos+1);
				console.log(tempPath);
				var fileName(path.substr(pos+1,path.length));
				console.log(fileName);
				pos=fileName.indexOf(".");
				var name=fileName.substr(0,pos);
				var ext=fileName.substr(pos,fileName.length);
				console.log(ext);
				
				var str="AbCdEf";
				console.log(str.toLowerCase());
				console.log(str.toUpperCase());
				
				var str11="abc";
				var str22="deef";
				var str33="fadga";
				console.log(str1.concat(str22,str33));
				
				var str44="aaa,bbb,ccc,d-dd,eee,fff";
				var strArr=str44.split(",");
				console.log(strArr);
				
				var stus[];
				var infoStr="1,张三,12;2,李四,11;3,王五,21";
				var infoArr=infoStr.split(";");
				for(var i=0;i<infoArr.length;i++){
					var info=infoArr[i];
					console.log(info);
					var stu={};
					stu.id=strInfoArr[0];
					stu.name=stuInfoArr[1];
					stu.age=stuInfoArr[2];
					stus[i]=stu;
				}
				console.log(stus);
			}
		</script>
	</body>
</html>
